
<!DOCTYPE html >
<html>
<head>
    <script src="../../libraries/RGraph.common.core.js" ></script>
    <script src="../../libraries/RGraph.bar.js" ></script>
    
    <title>An example of a Bar chart with bars-in-bars</title>
    
    <link rel="stylesheet" href="demos.css" type="text/css" media="screen" />
    
    <meta name="description" content="An example of a Bar chart with bars-in-bars" />
</head>
<body>

    <h1>An example of a Bar chart with bars-in-bars</h1>
    
    <p>
        By using two bar chart objects you can achieve a bar-in-bar effect. Here it shows the total amount of cars produced versus
        those sold. It's similar to a stacked or grouped Bar chart.
    </p>

    <canvas id="cvs" width="900" height="200" !style="border: 1px solid gray">[No canvas support]</canvas>
    <script>
        data = {}
        data.shipped = [88000,88000,105000,105000,116000,116000,126000];
        data.sold    = [30000,54000,54000,62000,63000,68000,68000];

        var bar1 = new RGraph.Bar('cvs', data.shipped)
            .Set('gutter.left', 50)
            .Set('colors', ['rgba(0,0,255,0.2)'])
            .Set('labels', ['Fred','Barney','Wilma','Betty','Dino','Bam-bam','Pebble'])
            .Set('labels.above', data.shipped)
            .Set('title', 'Total cars produced vs sold')
            .Draw();

        var bar2 = new RGraph.Bar('cvs', data.sold)
            .Set('ymax', bar1.scale2.max)
            .Set('gutter.left', bar1.Get('gutter.left'))
            .Set('colors', ['pink'])
            .Set('noaxes', true)
            .Set('labels.above', true)
            .Set('hmargin', 20)
            .Set('ylabels', false)
            .Set('background.grid', false)
            .Draw();
    </script>
    
    <br />
    
    <a href="./">&lt;Back</a><br />

</body>
</html>